package cn.zzdt4j.auth.config;

import cn.zzdt4j.auth.filter.RewriteUserInfoApiFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Filter config.
 *
 * @author by <a href="mailto:ligang941012@gmail.com">gang.Li</a>
 * @since 2023/10/28 22:08
 */
@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean<RewriteUserInfoApiFilter> userInfoApiFilterFilterRegistrationBean() {
        final FilterRegistrationBean<RewriteUserInfoApiFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new RewriteUserInfoApiFilter());
        registrationBean.addUrlPatterns("/*");
        return registrationBean;
    }
}
